import random
target = random.randint(1, 100)
coins = 5000
while coins >=500:
    guess = int(input("请输入数字："))
    if guess > target:
        coins -= 500
        print("大了")
        print(f"剩余金币: {coins}")
    elif guess < target:
        coins -= 500
        print("小了")
        print(f"剩余金币: {coins}")
    else:
        coins += 3000
        print(f"恭喜猜中！获得3000金币奖励！")
        print(f"恭喜猜中，本轮幸运数字：{target}")
        print(f"新的金币余额: {coins}")
        break

